package com.utf999.qiangmanger.entity.orm;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.utf999.qiangmanger.entity.UUIDEntity;

/**
 * 商品类型
 * @author yinwenjie
 *  @index companyname_typeName  unique (company,typeName)
 */
@Entity
@Table(name="B_CommodityType")
public class CommodityTypeEntity extends UUIDEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8417590051481657033L;

	/**
	 * 商品类型的所属公司
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="company" , nullable=false)
	private CompanyEntity company;
	
	/**
	 * 商品类型的名称<br>
	 * 同一个公司下，不允许出现名称相同的类型
	 */
	@Column(name="typeName" , length=128 , nullable=false)
	private String typeName;
	
	/**
	 * 创建时间
	 */
	@Column(name="createTime" , nullable=false)
	private Date createTime;
	
	public CompanyEntity getCompany() {
		return company;
	}

	public void setCompany(CompanyEntity company) {
		this.company = company;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	/* (non-Javadoc)
	 * @see com.utf999.qiangmanger.entity.UUIDEntity#getUniqueKey()
	 */
	@Override
	public String getUniqueKey() {
		return "uid";
	}
}
